from sqlalchemy import create_engine

engine = create_engine("mysql+pymysql://root:root@localhost/jobs")

try:
    connection = engine.connect()
    print("连接MYSQL成功")
    connection.close()
except Exception as e:
    print(f"数据库连接失败:{e}")
